QuickTime 3 supports a new type of component, known as a component alias, that is a reference to another component. A component alias does not contain code. The component it refers to, known as the target component, contains the necessary code.
If there are several related components that use the same code, such as importers for related file types, you can use component aliases to share the code rather than duplicating it for each component. Each of the component aliases can have its own subtype, manufacturer, name, icon, and other characteristics, even though it shares code with other components.
A component alias is contained in a resource of type kComponentAliasResourceType . This resource contains a component alias resource data structure:
struct ComponentAliasResource {
ComponentResource cr; /* registration parameters */
ComponentDescription aliasCD;/* target description */
};
The cr field is a ComponentResource structure that contains information needed to register the component. This information is used in the same way as registration information for ordinary components, with one exception: the specification of the code resource for the component is ignored.
The aliasCD field is a ComponentDescription structure that specifies the target for the alias. The next section, "How a Component Alias Is Resolved" , explains how this structure is used to find the target. The code resource of the target is used in place of the code resource specified in the cr field of the ComponentAliasResource structure.
To resolve a component alias, the Component Manager passes the contents of the aliasCD field of the ComponentAliasResource structure to the FindNextComponent function, just as an application would. This field includes all the information that is necessary to specify the target component. If there is no component that matches the specifications, the request to open the alias fails.
The Component Manager never resolves a component alias until the alias is opened. This lets you register component aliases before their target components are registered. It also lets you replace target components with other components.
Like other components, a component alias has a scope that determines which applications can use its services. The scope of a component alias is determined by the scope of its target component. If its scope is global, its services are available to all applications. If its scope is local, its services are available only to the application that registers it.